<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<script type="text/javascript">
	$(function() {

		$('#admin_wait_audit_member_datagrid').datagrid({
			url : '${pageContext.request.contextPath}/memberController/waitAuditDatagrid.action',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10, 20, 30, 40, 50 ],
			sortName : 'createTime',
			sortOrder : 'desc',
			checkOnSelect : false,
			selectOnCheck : false,
			nowrap : false,
			frozenColumns : [ [ {
				field : 'id', title : '编号', checkbox : true}, {
				field : 'cardId', title : '卡号', sortable : true
			} ] ],
			columns : [ [ {
				field : 'name', title : '姓名', sortable : true}, {
				field : 'createTime', title : '创建时间', sortable : true}, {
				field : 'mobile', title : '手机号', sortable : true}, {
				field : 'email', title : '电子邮箱', sortable : true}, {
				field : 'statusName', title : '状态', sortable : true}, {
				field : 'memberTypeName', title : '会员类型', sortable : true},{
				field : 'cid', title : '身份证号', sortable : true}, {
				field : 'genderName', title : '性别', sortable : true}, {
				field : 'payTypeName', title : '注册支付方式', sortable : true}, {
				field : 'regCharge', title : '注册时缴费金额（元）', sortable : true, align : 'right'}, {
				field : 'memberFee', title : '会费（元）', sortable : true, align : 'right'}, {
				field : 'balance', title : '消费余额（元）', sortable : true, align : 'right'}, {
				field : 'serialNumber', title : '支付流水号（注册）', sortable : true, align : 'right'}, {
				field : 'action', title : '审核会员', formatter : function(value, row, index) {
					if (false) {
					} else {
						return formatString('<img onclick="admin_member_auditFun(\'{0}\');" src="{1}"/ title="审核会员">', row.id, '${pageContext.request.contextPath}/style/images/extjs_icons/pencil.png');
					}
				}
			}]]
		});

	});

	function admin_member_auditFun(id) {
		$('#admin_wait_audit_member_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
		$('<div/>').dialog({
			href : '${pageContext.request.contextPath}/admin/member_audit.jsp',
			width : 600,
			height : 500,
			modal : true,
			title : '审核会员',
			buttons : [ {
				text : '保存',
				iconCls : 'icon-edit',
				handler : function() {
					var d = $(this).closest('.window-body');
					$('#admin_memberAudit_editForm').form('submit', {
						url : '${pageContext.request.contextPath}/memberController/audit.action',
						success : function(result) {
							try {
								var r = $.parseJSON(result);
								if (r.success) {
									$('#admin_wait_audit_member_datagrid').datagrid('load');
									d.dialog('destroy');
								}
								$.messager.show({
									title : '提示',
									msg : r.msg
								});
							} catch (e) {
								$.messager.alert('提示', result);
							}
						}
					});
				}
			} ],
			onClose : function() {
				$(this).dialog('destroy');
			},
			onLoad : function() {
				var index = $('#admin_wait_audit_member_datagrid').datagrid('getRowIndex', id);
				var rows = $('#admin_wait_audit_member_datagrid').datagrid('getRows');
				var o = rows[index];
				$('#admin_memberAudit_editForm').form('load', o);
			}
		});
	}
	
</script>
<table id="admin_wait_audit_member_datagrid"></table>